package au.com.twosquared.tools;

import java.util.ArrayList;

public class Inventory extends ArrayList<Item> {
	
	public Item getInventory(int ID){
		for (Item i : this){
			if (i.getID() == ID){
				return i;
			}else error; //Dont remember how to return an error Derp
		}
	}

	public void addInventory(int ID, int amount) {
		for (Item i : this) {
			if (i.getID() == ID) {
				if ((i.getAmount()+amount) >= 99){
					System.out.printf("You can't hold that many %d", i.getName());
				}else i.addAmount(amount);
			}
		}
	}

	public void useInventory(int ID, int amount) {
		for (Item i : this) {
			if (i.getID() == ID) {
				if ((i.getAmount()-amount) < 0){
					System.out.printf("You don't have enough %d", i.getName());
				}else i.useAmount(amount);
			}
		}
	}
}
